//
//  OilViewCell.swift
//  TrafficViolation
//
//  Created by eaglelive on 2017/5/24.
//  Copyright © 2017年 eaglelive. All rights reserved.
//

import UIKit

class OilViewCell: UITableViewCell {
    var province,oil0,oil89,oil90,oil92,oil93,oil95,oil97:UILabel!
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = UITableViewCellSelectionStyle.none
        self.backgroundColor = UIColor(red: 243/255.0, green: 243/255.0, blue: 243/255.0, alpha: 1.0)
        let backgroundView = UIView()
        backgroundView.layer.borderColor = colorFromHex(0xeeeeee).cgColor
        backgroundView.layer.borderWidth = 1
        backgroundView.layer.masksToBounds = true
        backgroundView.backgroundColor = UIColor.white
        self.addSubview(backgroundView)
        backgroundView.snp.makeConstraints { (make) in
            make.left.equalTo(self)
            make.top.equalTo(self)
            make.right.equalTo(self)
            make.bottom.equalTo(self)
        }
        province = UILabel()
        province.font = UIFont.systemFont(ofSize: 13)
        province.textAlignment = .center
        backgroundView.addSubview(province)
        province.snp.makeConstraints { (make) in
            make.width.equalTo(kScreenW/8)
            make.height.equalTo(40)
            make.top.equalTo(backgroundView.snp.top)
            make.left.equalTo(backgroundView.snp.left)
        }
        oil0 = UILabel()
        oil0.font = UIFont.systemFont(ofSize: 13)
        oil0.textColor = UIColor.gray
        oil0.textAlignment = .center
        backgroundView.addSubview(oil0)
        oil0.snp.makeConstraints { (make) in
            make.width.equalTo(kScreenW/8)
            make.height.equalTo(40)
            make.top.equalTo(backgroundView.snp.top)
            make.left.equalTo(province.snp.right)
        }
        oil89 = UILabel()
        oil89.font = UIFont.systemFont(ofSize: 13)
        oil89.textAlignment = .center
        backgroundView.addSubview(oil89)
        oil89.snp.makeConstraints { (make) in
            make.width.equalTo(kScreenW/8)
            make.height.equalTo(40)
            make.top.equalTo(backgroundView.snp.top)
            make.left.equalTo(oil0.snp.right)
        }
        oil90 = UILabel()
        oil90.font = UIFont.systemFont(ofSize: 13)
        oil90.textColor = UIColor.gray
        oil90.textAlignment = .center
        backgroundView.addSubview(oil90)
        oil90.snp.makeConstraints { (make) in
            make.width.equalTo(kScreenW/8)
            make.height.equalTo(40)
            make.top.equalTo(backgroundView.snp.top)
            make.left.equalTo(oil89.snp.right)
        }
        oil92 = UILabel()
        oil92.font = UIFont.systemFont(ofSize: 13)
        oil92.textAlignment = .center
        backgroundView.addSubview(oil92)
        oil92.snp.makeConstraints { (make) in
            make.width.equalTo(kScreenW/8)
            make.height.equalTo(40)
            make.top.equalTo(backgroundView.snp.top)
            make.left.equalTo(oil90.snp.right)
        }
        oil93 = UILabel()
        oil93.font = UIFont.systemFont(ofSize: 13)
        oil93.textColor = UIColor.gray
        oil93.textAlignment = .center
        backgroundView.addSubview(oil93)
        oil93.snp.makeConstraints { (make) in
            make.width.equalTo(kScreenW/8)
            make.height.equalTo(40)
            make.top.equalTo(backgroundView.snp.top)
            make.left.equalTo(oil92.snp.right)
        }
        oil95 = UILabel()
        oil95.font = UIFont.systemFont(ofSize: 13)
        oil95.textAlignment = .center
        backgroundView.addSubview(oil95)
        oil95.snp.makeConstraints { (make) in
            make.width.equalTo(kScreenW/8)
            make.height.equalTo(40)
            make.top.equalTo(backgroundView.snp.top)
            make.left.equalTo(oil93.snp.right)
        }
        oil97 = UILabel()
        oil97.font = UIFont.systemFont(ofSize: 13)
        oil97.textColor = UIColor.gray
        oil97.textAlignment = .center
        backgroundView.addSubview(oil97)
        oil97.snp.makeConstraints { (make) in
            make.width.equalTo(kScreenW/8)
            make.height.equalTo(40)
            make.top.equalTo(backgroundView.snp.top)
            make.left.equalTo(oil95.snp.right)
        }
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
extension OilViewCell{
    func configCellDateWithModel(model:OilModel) {
        province.text = model.province
        oil0.text = model.oil0
        oil89.text = model.oil89
        oil90.text = model.oil90
        oil92.text = model.oil92
        oil93.text = model.oil93
        oil95.text = model.oil95
        oil97.text = model.oil97
    }
}
